<template>
  <div><br>
      <el-button type="primary"  @click="tianjia()">添加体检项目</el-button>
      <el-table :data="Data" style="width: 100%">
         <el-table-column prop="id" label="项目ID" ></el-table-column>
         <el-table-column prop="setMealName" label="项目名称" ></el-table-column>
         <el-table-column prop="img" label="项目金额（元）" ></el-table-column>
         <el-table-column prop="pkName" label="所属套餐" ></el-table-column>
         <el-table-column prop="campusName" label="项目介绍" ></el-table-column>
         <el-table-column prop="price" label="注意事项" ></el-table-column>
         <el-table-column prop="pkMenu" label="套餐项目" ></el-table-column>
         <el-table-column label="操作" v-slot="a">
             <el-button type="primary" size="mini" @click="xiugai(a.row)">修改</el-button>
             <el-button type="primary" size="mini" @click="shanchu(a.row)">删除</el-button>
         </el-table-column>
      </el-table>
    <div>
      <el-dialog title="是否删除" :visible.sync="delmtk" :model="del">
        <el-button type="primary" @click="delMeal()">确定</el-button>
        <el-button type="primary" @click="delmtk=false" >取消</el-button>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
    created(){
        this.finMealAll();
    },
    data(){
        return{
            Data:[],
            upd:{},
            delmtk:false,
            del:{},
        }
    },
    methods:{
        finMealAll(){
           
            this.$axios.get("/user/user/doctor/ren/finMealAll").then(res=>{ console.log(res.data.data.list)
                this.Data=res.data.data.list
            })
        },
         xiugai(row){
          this.$router.push({path: "/MealUpd",query: {row: row}});
          this.upd = {...row}
        },
        tianjia(){
            this.$router.push({path: "/MealAdd"});
        },
        shanchu(row){
            this.delmtk=true;
            this.del = { ...row };
        },
        delMeal(){
            this.$axios.post("/user/user/doctor/ren/delMeal",this.del).then(res=>{
            this.delmtk=false;
            this.finMealAll();
            })
        },
    }
}   
</script>

<style>

</style>